import matplotlib.pyplot as plt
import numpy as np

# 生成随机数据
np.random.seed(42)
x = np.random.randn(100)
y = 2 * x + np.random.randn(100) * 0.5

plt.figure(figsize=(8, 6))
plt.scatter(x, y, alpha=0.7, c='red', edgecolors='black')

plt.title('散点图示例')
plt.xlabel('X 变量')
plt.ylabel('Y 变量')
plt.grid(True, alpha=0.3)
plt.show()